package com.android.kmlmrg.views;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.os.Message;
import android.util.Log;

import com.android.kmlmrg.R;
import com.android.kmlmrg.services.ServiceController;
import com.android.kmlmrg.utils.Const;

public class SplashScreen  extends Activity implements Const{

	/**LOG**/
	private static final  String LOG_TAG = Activity.class.getName();
	 
	@Override
    public void onCreate(Bundle savedInstanceState) {
		Log.i(LOG_TAG, "START - onCreate(Bundle savedInstanceState)");
        super.onCreate(savedInstanceState);
        setContentView(R.layout.splash_screen);
        final Message msg = new Message();
        msg.what = STOPSPLASH;
        splashHandler.sendMessageDelayed(msg, SPLASHTIME);
        ServiceController.getInstance(getApplication(), "admin", "admin");
        Log.i(LOG_TAG, "END - onCreate");
    	
	}
	
	private final transient Handler splashHandler = new Handler()
    {     
		@Override
        public void handleMessage(Message msg)
        {
        	if (msg.what == STOPSPLASH)
            {
        		final Intent intent = new Intent(SplashScreen.this, FormAuthentication.class);
                startActivity(intent);
                finish();
            }

        	super.handleMessage(msg);
        }
    };

}
